package np.com.baralsujan.algorithms;

public class PrimeNumber {

	public static void main(String[] args) {
		int count = 0;
		long start = System.currentTimeMillis();
		for (int i = 2; i < 100000; i++) {
			if (isPrime(i)) {
				count++;
			}
		}
		System.out.println(System.currentTimeMillis() - start);
		System.out.println(count);
	}

	public static boolean isPrime(int n) {
		boolean prime = true;
		for (int i = 2; i <= (int) Math.sqrt(n); i++) {
			if (n % i == 0) {
				prime = false;
				break;
			}
		}
		return prime;
	}
}
